Skip to contentSkip to conversation

Change in openvpn[master]: ssl_util: Fix conversion warning in get_num_elements

Openvpn-devel In review flichtenheld (Code Review) 2 participants 5 messages Oct 17, 2025 – Oct 18, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1760698129000.I2d1fbe7ec080beb931253d09c1b5227e9bf4e756@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1281?usp=email

to review the following change.

Change subject: ssl_util: Fix conversion warning in get_num_elements
......................................................................

ssl_util: Fix conversion warning in get_num_elements

Just use correct type.

Change-Id I2d1fbe7ec080beb931253d09c1b5227e9bf4e756

---
M src/openvpn/ssl_util.c

1 file changed, 2 insertions(+), 11 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/81/1281/1

src/openvpn/ssl_util.c +2 -11
index 50e8c03..fb7cf3e 100644
@@ -290,21 +290,16 @@
     return NULL;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 int
 get_num_elements(const char *string, char delimiter)
 {
-    int string_len = strlen(string);
+    const size_t string_len = strlen(string);
 
     ASSERT(0 != string_len);
 
     int element_count = 1;
     /* Get number of ciphers */
-    for (int i = 0; i < string_len; i++)
+    for (size_t i = 0; i < string_len; i++)
     {
         if (string[i] == delimiter)
         {
@@ -314,7 +309,3 @@
 
     return element_count;
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1281?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d1fbe7ec080beb931253d09c1b5227e9bf4e756
Gerrit-Change-Number: 1281
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw

PATCH 1/1 ssl_util: Fix conversion warning in get_num_elements

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Just use correct type.

Change-Id I2d1fbe7ec080beb931253d09c1b5227e9bf4e756

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1281
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1281
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):

src/openvpn/ssl_util.c +2 -11
index 50e8c03..fb7cf3e 100644
@@ -290,21 +290,16 @@
     return NULL;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 int
 get_num_elements(const char *string, char delimiter)
 {
-    int string_len = strlen(string);
+    const size_t string_len = strlen(string);
 
     ASSERT(0 != string_len);
 
     int element_count = 1;
     /* Get number of ciphers */
-    for (int i = 0; i < string_len; i++)
+    for (size_t i = 0; i < string_len; i++)
     {
         if (string[i] == delimiter)
         {
@@ -314,7 +309,3 @@
 
     return element_count;
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
#3 lore raw

[Openvpn-devel] [PATCH applied] Re: ssl_util: Fix conversion warning in get_num_elements

"Just using the correct type" sounds like a great plan :-) - code change looks good, BB confirms.

Your patch has been applied to the master branch.

commit f93a0f3fd67bb12ba5efe05652f822585e018a84

Author: Frank Lichtenheld
Date:   Fri Oct 17 22:49:09 2025 +0200
     ssl_util: Fix conversion warning in get_num_elements

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1281
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg33421.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#4 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1281?usp=email )

Change subject: ssl_util: Fix conversion warning in get_num_elements
......................................................................

ssl_util: Fix conversion warning in get_num_elements

Just use correct type.

Change-Id I2d1fbe7ec080beb931253d09c1b5227e9bf4e756

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1281
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33421.html

---
M src/openvpn/ssl_util.c

1 file changed, 2 insertions(+), 11 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/81/1281/2

src/openvpn/ssl_util.c +2 -11
index 50e8c03..fb7cf3e 100644
@@ -290,21 +290,16 @@
     return NULL;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 int
 get_num_elements(const char *string, char delimiter)
 {
-    int string_len = strlen(string);
+    const size_t string_len = strlen(string);
 
     ASSERT(0 != string_len);
 
     int element_count = 1;
     /* Get number of ciphers */
-    for (int i = 0; i < string_len; i++)
+    for (size_t i = 0; i < string_len; i++)
     {
         if (string[i] == delimiter)
         {
@@ -314,7 +309,3 @@
 
     return element_count;
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1281?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d1fbe7ec080beb931253d09c1b5227e9bf4e756
Gerrit-Change-Number: 1281
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#5 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1281?usp=email )

Change subject: ssl_util: Fix conversion warning in get_num_elements
......................................................................

ssl_util: Fix conversion warning in get_num_elements

Just use correct type.

Change-Id I2d1fbe7ec080beb931253d09c1b5227e9bf4e756

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1281
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33421.html

---
M src/openvpn/ssl_util.c

1 file changed, 2 insertions(+), 11 deletions(-)
src/openvpn/ssl_util.c +2 -11
index 50e8c03..fb7cf3e 100644
@@ -290,21 +290,16 @@
     return NULL;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 int
 get_num_elements(const char *string, char delimiter)
 {
-    int string_len = strlen(string);
+    const size_t string_len = strlen(string);
 
     ASSERT(0 != string_len);
 
     int element_count = 1;
     /* Get number of ciphers */
-    for (int i = 0; i < string_len; i++)
+    for (size_t i = 0; i < string_len; i++)
     {
         if (string[i] == delimiter)
         {
@@ -314,7 +309,3 @@
 
     return element_count;
 }
-
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1281?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d1fbe7ec080beb931253d09c1b5227e9bf4e756
Gerrit-Change-Number: 1281
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>